<template>
  <div>
  </div>
</template>

<script>
  export default {
    name: 'login',
    data() {
      return {
        loading: ''
      }
    },
    created() {
      this.init()
    },
    methods: {
      init() {
        this.loading = this.$loading({
          lock: true,
          text: '登录中……',
          spinner: 'el-icon-loading'
        })
        const data = this.getCurrentPage().query
        data.enterpriseConfig = {
          platformAuthority: 1,
          supplyAllianceAuthority: 1,
          deliveryTemplateAuthority: 1,
          anchorAutoApprove: 1,
          memberPriceAuthority: 1,
          groupBuyAuthority: 1,
          storeHomeAuthority: 1,
          communityDistributionAuthority: 1
        }
        this.$store.dispatch('LoginByAnonymous', data).then(() => {
          this.loading.close()
          // 匿名登录，默认显示标题为众项云企
          document.title = '众项云企'
          this.$pt.setStorageSync('document.title', '众项云企')
          if (this.$utils.isExist(data.redirectUrl)) {
            this.$router.push({ path: '/' + decodeURI(data.redirectUrl) })
          } else {
            this.$router.push({ path: '/' })
          }
        })
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
